<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>基础设置</title>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/bootcdn/BootCDN/ajax/libs/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="<%=path%>/hplus/css/style.min.css"/>
<link rel="stylesheet" type="text/css" href="<%=path%>/hplus/css/font-awesome.min93e3.css"/>
<link rel="stylesheet" type="text/css" href="<%=path%>/hplus/css/plugins/iCheck/custom.css"/>
<style type="text/css">
.highCondition{display: none;}
</style>
</head>
<body>
<div class="container-fluid">
	<form class="form-horizontal">
	    <div class="form-group">
	        <label class="col-sm-2 control-label">规则名称</label>
	        <div class="col-sm-4">
	            <input id="name" type="text" placeholder="可输入任意不重复的名称" maxlength="10" class="form-control">
	        </div>
	        <div class="col-sm-3 control-label">
				<p class="text-left">限10个中文字符之内</p>
	        </div>
	    </div>
	    <div class="form-group">
	        <label class="col-sm-2 control-label" style="padding-top: 14px;">搜索频次</label>
	        <div class="col-sm-5" style="padding-left: 0;">
	        	<div class="radio i-checks">
                    <label>
                    	<input type="radio" value="小时" name="frequency" checked="checked">
	                	每&nbsp;<input type="number" min="1" max="24" onkeyup="this.value=this.value.replace(/\D/g,'')" placeholder="请输入1-24的整数" class="form-control" style="display:inline-block;width: 160px;">&nbsp;小时1次
                    </label>
                </div>
                <div class="radio i-checks highCondition">
                    <label>
                    	<input type="radio" value="分钟" name="frequency">
	                                        每&nbsp;<input type="number" min="1" max="60" placeholder="请输入1-60的整数" class="form-control" style="display:inline-block;width: 140px;">&nbsp;分钟1次
                    </label>
                </div>
                <div class="radio i-checks highCondition">
                    <label>
                    	<input type="radio" value="天" name="frequency">
	                                        每&nbsp;<input type="number" min="1" placeholder="请输入整数" class="form-control" style="display:inline-block;width: 140px;">&nbsp;天1次
                    </label>
                </div>
	        </div>
	    </div>
	    <div class="form-group">
	        <label class="col-sm-2 control-label">请求接续</label>
	        <div class="col-sm-3" style="padding-left: 0;">
	        	<div class="radio i-checks">
                    <label>
                    	<input type="radio" name="starttime" checked="checked">
	                    <input type="hidden" value="0">
	                	接续上次请求
                    </label>
                </div>
	        </div>
	        <div class="col-sm-4 highCondition" style="padding-left: 0;">
	        	<div class="radio i-checks" style="padding-top: 0;">
                    <label>
                    	<input type="radio" name="starttime">
	                	只求最近&nbsp;<input type="text" placeholder="请输入整数" class="form-control" style="display:inline-block;width: 100px;">&nbsp;小时
                    </label>
                </div>
	        </div>
	    </div>
	    <div class="form-group">
            <div class="col-sm-offset-7 col-sm-3 text-center">
				<a style="color: #18a689;font-weight: bold;display: none;" id="highCondition">更多高级条件设置</a>
            </div>
        </div>
	    <div class="form-group">
            <div class="col-sm-offset-2 col-sm-1">
                <button onclick="parent.baseSetDialog.remove()" class="btn btn-sm btn-white" type="button" style="width: 58px;border-color: #18a689;">取消</button>
            </div>
            <div class="col-sm-offset-2 col-sm-1">
                <button onclick="parent.func_optionDialog()" class="btn btn-sm btn-primary" type="button">下一步</button>
            </div>
        </div>
	</form>
</div>
</body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/bootcdn/BootCDN/ajax/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script type="text/javascript" src="<%=path%>/hplus/js/plugins/iCheck/icheck.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/artDialog/7.0.0/dialog-plus.js"></script>
<script type="text/javascript">
$(function(){
	$(".i-checks").iCheck({checkboxClass:"icheckbox_square-green",radioClass:"iradio_square-green",});
	$("#highCondition").click(function(){
		if($(this).text() == "更多高级条件设置"){
			$(this).text("收起高级条件设置");
			$(".highCondition").show();
			
			parent.baseSetDialog.height(340);
		}else{
			$(this).text("更多高级条件设置");
			$(".highCondition").hide();
			
			parent.baseSetDialog.height(240);
		}
	});
	
	init();
});

function init(){
	func_backShow();
}

//回显
function func_backShow(){
	if(parent.rule != null){
		$("#name").val(parent.rule.name);
		var frequency = parent.rule.frequency;
		if(frequency.indexOf("小时") >= 0){
			$(":radio[value='小时']").iCheck('check');
			$(":radio[value='小时']").parent().next("input[type='number']").val(frequency.split("小时")[0]);
		}else if(frequency.indexOf("分钟") >= 0){
			$("#highCondition").click();
			$(":radio[value='分钟']").iCheck('check');
			$(":radio[value='小时']").parent().next("input[type='number']").val(frequency.split("分钟")[0]);
		}else if(frequency.indexOf("天") >= 0){
			$("#highCondition").click();
			$(":radio[value='天']").iCheck('check');
			$(":radio[value='小时']").parent().next("input[type='number']").val(frequency.split("天")[0]);
		}
		var starttime = parent.rule.starttime;
		if(starttime != 0){
			$("#highCondition").click();
			$(":radio[name='starttime']:eq(1)").iCheck('check');
			$(":radio[name='starttime']:eq(1)").parent().next(":text").val(starttime);
		}
	}
}
</script>
</html>